package cn.memorynine.consumer.controller;

import cn.memorynine.consumer.model.forum.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import cn.memorynine.common.model.ResponseWrapper;
import cn.memorynine.consumer.service.ForumService;
import cn.memorynine.common.model.ResponseWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestBody;

/**
* 用户前台-论坛控制器
* @author 代码生成器
*/
@Slf4j
@RestController
@RequestMapping("/consumer/forum")
public class ForumController {
    @Autowired
    private ForumService forumService;

    /**
     * 1.查看论坛列表
     * @return
     */
    @RequestMapping("/forumList")
    public ResponseWrapper forumList(@RequestBody @Validated ForumListParam param){
        return forumService.forumList(param);
    }

    /**
     * 2.查看论坛信息
     * @return
     */
    @RequestMapping("/forumInfo")
    public ResponseWrapper forumInfo(@RequestBody @Validated ForumInfoParam param){
        return forumService.forumInfo(param);
    }

    /**
     * 3.查看帖子列表
     * @return
     */
    @RequestMapping("/postList")
    public ResponseWrapper postList(@RequestBody @Validated PostListParam param){
        return forumService.postList(param);
    }

    /**
     * 4.查看帖子详情
     * @return
     */
    @RequestMapping("/postInfo")
    public ResponseWrapper postInfo(@RequestBody @Validated PostInfoParam param){
        return forumService.postInfo(param);
    }

    /**
     * 5.评论帖子
     * @return
     */
    @RequestMapping("/postComment")
    public ResponseWrapper postComment(@RequestBody @Validated PostCommentParam param){
        return forumService.postComment(param);
    }

    /**
     * 6.删除评论
     * @return
     */
    @RequestMapping("/delComment")
    public ResponseWrapper delComment(@RequestBody @Validated DelCommentParam param){
        return forumService.delComment(param);
    }

    /**
     * 7.删除帖子
     * @return
     */
    @RequestMapping("/delPost")
    public ResponseWrapper delPost(@RequestBody @Validated DelPostParam param){
        return forumService.delPost(param);
    }

    /**
     * 8.获取帖子下的评论
     * @return
     */
    @RequestMapping("/replyList")
    public ResponseWrapper replyList(@RequestBody @Validated ReplyListParam param){
        return forumService.replyList(param);
    }

    /**
     *9.发布帖子
     */
    @RequestMapping("/savePost")
    public ResponseWrapper savePost(@RequestBody @Validated SavePostParam param){
        return forumService.savePost(param);
    }


}